#include <stdlib.h>
#include <stdio.h>
#include <err.h>
#include "syntax.h"
#include "list.h"

Syntax *immediate_new(int value){
    Immediate *immediate = malloc(sizeof(Immediate));
    immediate->value = value;
    Syntax *syntax= malloc(sizeof(Syntax));
    syntax->type = IMMEDIATE;
    return syntax;
}
Syntax *variable_new(char *var_name){
    Variable *variable= malloc(sizeof(Variable));
    variable->var_name=var_name;
    Syntax *syntax=malloc(sizeof(Syntax));
    syntax->type=VARIABLE;
    syntax->variable = variable;
    return syntax;
} 
Syntax *bitwis_negation_new(Syntax *expression){
    
}

void stack_free(Stack *stack){
    if(stack->size>0){
        free(stack->content)
    }
    free(stack);
}

void stack_push(Stack *stack, void *item){
    stack->size++;
    stack->content= 
         realloc(stack->content, stack->size* sizeof *stack->content);
    stack->content[stack->size-1]=item;
}

void *stack_pop(Stack *stack){
    if(stack->size>0){
        free(stack->content)
    }
    free(stack)
}